home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 November / Cd users extra 14.iso / prog / inst / mailc / stat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-14  |  1.0 KB  |  42 lines

  1. /*
  2. **  STAT.C [edit EMAIL.H before compiling]
  3. **
  4. **  This program dislays the number of email messages 
  5. **  waiting on the SMTP server.
  6. */
  7.  
  8. #include <windows.h>
  9. #include <stdio.h>
  10. #include "see.h"
  11.  
  12. #include "email.h"
  13.  
  14. static char Buffer[512];
  15.  
  16. void ErrorExit(int Code)
  17. {seeErrorText(Code,(LPSTR)Buffer,512);
  18.  printf("SEE Error %d: %s\n", Code, Buffer);
  19.  exit(1);
  20. }
  21.  
  22. void main(int argc, char *argv[])
  23. {int Code; 
  24.  /* define diagnostics log file */
  25.  ///seeStringParam(SEE_LOG_FILE, (LPSTR)"stat.log"); 
  26.  /* connect to POP3 server */
  27.  puts("Connecting...");
  28.  Code = seePop3Connect(
  29.     (LPSTR)POP3_HOST_NAME,                   /* POP3 server */
  30.     (LPSTR)POP3_USER_NAME,                   /* user */ 
  31.     (LPSTR)POP3_PASSWORD);                   /* Password */
  32.  if(Code<0) ErrorExit(Code); 
  33.  /* get # messages waiting  */
  34.  puts("Getting message status...");
  35.  Code = seeGetEmailCount();                   
  36.  if(Code<0) ErrorExit(Code); 
  37.  printf("%d messages waiting\n", Code);
  38.  seeClose();
  39. } /* end main */
  40.  
  41.  
  42.